package cn.bugstack.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @description:
 * @author: wwq
 * @date: 2025/06/24/17:46
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AppException extends RuntimeException{

    private static final long serialVersionUID = 9140948194766445339L;

    /**
     * 异常码
     */
    private String code;
    /**
     * 异常信息
     */
    private String info;


    public AppException(String code) {
        this.code = code;
    }

    public AppException(Throwable cause, String code) {
        super.initCause(cause);
        this.code = code;
    }

    public AppException(String message, Throwable cause, String code) {
        super.initCause(cause);
        this.code = code;
        this.info = message;
    }

    @Override
    public String toString() {
        return "cn.bugstack.common.exception.AppException{" +
                "code='" + code + '\'' +
                ", info='" + info + '\'' +
                '}';
    }
}


